package abc2;

public class abc {

	public static void main(String[] args) {
		int count=0;
		for(int i=1;i<=1000;i++){
			if(i%7==0||i%10==7){
				System.out.print(i+" ");
				count++;
				if(count==5){
					count=0;
					System.out.println();
				}
			}
		}
	}
}
